package com.hyg.lib_common.DataModel.QuestionNaire;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.ArrayList;

public class PhysiqueTitleModel implements Parcelable {

    private String title = "";                  //题目
    private String tizhiOne = "";               //对应的体质1 号
    private boolean tizhiOneMeasure = true;     //体质得分计算的 正反 顺序； 正序为true，反序为false
    private String tizhiTwo = "";               //对应的体质2 号
    private boolean tizhiTwoMeasure = true;     //体质得分计算的 正反 顺序； 正序为true，反序为false
    public ArrayList<String> answer = new ArrayList<String>();           //题目对应答案选项
    private int gender = 0;                     //性别特定题   0：无性； 1：男性； 2：女性；
    private int finalChoice = 0;                // 最终选择的选项号（等同分值）

    public PhysiqueTitleModel(String title, String tizhiOne, boolean tizhiOneMeasure, String tizhiTwo, boolean tizhiTwoMeasure, ArrayList<String> problemAnswer, int gender){
        this.title = title;
        this.tizhiOne = tizhiOne;
        this.tizhiOneMeasure = tizhiOneMeasure;
        this.tizhiTwo = tizhiTwo;
        this.tizhiTwoMeasure = tizhiTwoMeasure;
        this.answer.addAll(problemAnswer);
        this.gender = gender;
    }

    public PhysiqueTitleModel(String title, String tizhiOne, boolean tizhiOneMeasure, String tizhiTwo, boolean tizhiTwoMeasure, int gender){
        this.title = title;
        this.tizhiOne = tizhiOne;
        this.tizhiOneMeasure = tizhiOneMeasure;
        this.tizhiTwo = tizhiTwo;
        this.tizhiTwoMeasure = tizhiTwoMeasure;
        ArrayList<String> answers = new ArrayList<String>();
        answer.add("没有(根本不)");
        answer.add("很少(有一点)");
        answer.add("有时(有些)");
        answer.add("经常(相当)");
        answer.add("总是(非常)");
        this.answer.addAll(answers);
        this.gender = gender;
    }


    protected PhysiqueTitleModel(Parcel in) {
        title = in.readString();
        tizhiOne = in.readString();
        tizhiOneMeasure = in.readByte() != 0;
        tizhiTwo = in.readString();
        tizhiTwoMeasure = in.readByte() != 0;
        answer = in.createStringArrayList();
        gender = in.readInt();
        finalChoice = in.readInt();
    }

    public static final Creator<PhysiqueTitleModel> CREATOR = new Creator<PhysiqueTitleModel>() {
        @Override
        public PhysiqueTitleModel createFromParcel(Parcel in) {
            return new PhysiqueTitleModel(in);
        }

        @Override
        public PhysiqueTitleModel[] newArray(int size) {
            return new PhysiqueTitleModel[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(title);
        dest.writeString(tizhiOne);
        dest.writeByte((byte) (tizhiOneMeasure ? 1 : 0));
        dest.writeString(tizhiTwo);
        dest.writeByte((byte) (tizhiTwoMeasure ? 1 : 0));
        dest.writeStringList(answer);
        dest.writeInt(gender);
        dest.writeInt(finalChoice);
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getTizhiOne() {
        return tizhiOne;
    }

    public void setTizhiOne(String tizhiOne) {
        this.tizhiOne = tizhiOne;
    }

    public boolean isTizhiOneMeasure() {
        return tizhiOneMeasure;
    }

    public void setTizhiOneMeasure(boolean tizhiOneMeasure) {
        this.tizhiOneMeasure = tizhiOneMeasure;
    }

    public String getTizhiTwo() {
        return tizhiTwo;
    }

    public void setTizhiTwo(String tizhiTwo) {
        this.tizhiTwo = tizhiTwo;
    }

    public boolean isTizhiTwoMeasure() {
        return tizhiTwoMeasure;
    }

    public void setTizhiTwoMeasure(boolean tizhiTwoMeasure) {
        this.tizhiTwoMeasure = tizhiTwoMeasure;
    }

    public ArrayList<String> getAnswer() {
        return answer;
    }

    public void setAnswer(ArrayList<String> answer) {
        this.answer = answer;
    }

    public int getGender() {
        return gender;
    }

    public void setGender(int gender) {
        this.gender = gender;
    }

    public int getFinalChoice() {
        return finalChoice;
    }

    public void setFinalChoice(int finalChoice) {
        this.finalChoice = finalChoice;
    }

}
